The various changes to move to using info instead of passing the config
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Sat, 12 Nov 2005 17:59:56 +0000 (18:59 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Sat, 12 Nov 2005 17:59:56 +0000 (18:59 +0100)
sxpr everywhere broke the use of a boot loader for booting with.  The
attached fixes things up so that
a) use of a bootloader ==> kernel not specified in the config file
b) don't cleanup bootloader files until after the domain has booted
c) rerun bootloader on reboot

Signed-off-by: Jeremy Katz <katzj@redhat.com>
tools/python/xen/xend/XendDomainInfo.py
tools/python/xen/xend/image.py
tools/python/xen/xm/create.py

index 1e06748d5db98b9a3976693dcbeec3d72f02a47f..886d5c4f0f7f4db7f1bf2ac23a0922dd75d2f2b1 100644 (file)
@@ -1049,9 +1049,6 @@ class XendDomainInfo:
                                   self.info['image'],
                                   self.info['device'])
 
-        if self.info['bootloader']:
-            self.image.handleBootloading()
-
         xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
 
         m = self.image.getDomainMemory(self.info['memory'] * 1024)
@@ -1074,6 +1071,9 @@ class XendDomainInfo:
 
         self.createDevices()
 
+        if self.info['bootloader']:
+            self.image.cleanupBootloading()
+
         self.info['start_time'] = time.time()
 
 
@@ -1238,6 +1238,7 @@ class XendDomainInfo:
         False if it is to be destroyed.
         """
 
+        self.configure_bootloader()
         config = self.sxpr()
 
         if self.readVm(RESTART_IN_PROGRESS):
@@ -1340,8 +1341,9 @@ class XendDomainInfo:
         # FIXME: this assumes the disk is the first device and
         # that we're booting from the first disk
         blcfg = None
+        config = self.sxpr()
         # FIXME: this assumes that we want to use the first disk
-        dev = sxp.child_value(self.config, "device")
+        dev = sxp.child_value(config, "device")
         if dev:
             disk = sxp.child_value(dev, "uname")
             fn = blkdev_uname_to_file(disk)
@@ -1351,7 +1353,7 @@ class XendDomainInfo:
             msg = "Had a bootloader specified, but can't find disk"
             log.error(msg)
             raise VmError(msg)
-        self.config = sxp.merge(['vm', ['image', blcfg]], self.config)
+        self.info['image'] = sxp.to_string(blcfg)
 
 
     def send_sysrq(self, key):
index b4111d8768f53b87c938927bda69f3b01c9f675d..77d07ea545a6188f5df8db13de95f796b3521990 100644 (file)
@@ -95,7 +95,7 @@ class ImageHandler:
                         ("image/ramdisk", self.ramdisk))
 
 
-    def handleBootloading(self):
+    def cleanupBootloading(self):
         self.unlink(self.kernel)
         self.unlink(self.ramdisk)
 
index af7080fd568893824bc87ef12f8d6a2ca7960538..23ea2ba97504bd09d4c6d013d4997b877523780f 100644 (file)
@@ -565,7 +565,7 @@ def run_bootloader(vals):
     file = blkif.blkdev_uname_to_file(uname)
 
     return bootloader(vals.bootloader, file, not vals.console_autoconnect,
-                      vals.vcpus, vals.blentry)
+                      vals.vcpus, vals.bootentry)
 
 def make_config(vals):
     """Create the domain configuration.
@@ -781,7 +781,7 @@ def preprocess_vnc(vals):
         vals.extra = vnc + ' ' + vals.extra
     
 def preprocess(vals):
-    if not vals.kernel:
+    if not vals.kernel and not vals.bootloader:
         err("No kernel specified")
     preprocess_disk(vals)
     preprocess_pci(vals)